Skip to content

Conversation

@Harkunwar
Copy link
Contributor

@Harkunwar Harkunwar commented May 12, 2023

Description

Refactored this hook because it seems like the hook does something which isn't obvious from the name, which is mainly to get the download link for Node JS. detectOS is already a quick synchronous function so it doesn't make sense to have a hook to do the same either. Moreover, we're using useEffect when we don't need to, and it's bad for performance. We should avoid it whenever we can. Lastly, we should use swr for all async for better error handling. This PR also adds types for navigator so we don't need to ignore them and can be fully type safe.

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo lint to ensure the code follows the style guide. And run npx turbo lint:fix to fix the style errors if necessary.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing, and/or npx turbo test:snapshot to update snapshots if I created and/or updated React Components.
  • I've covered new added functionality with unit tests if necessary.

@vercel
Copy link

vercel bot commented May 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2023 1:00am
nodejs-org-stories ✅ Ready (Inspect) Visit Preview May 15, 2023 1:00am

@Harkunwar Harkunwar changed the base branch from main to major/website-redesign May 12, 2023 19:16
@vercel vercel bot temporarily deployed to Preview – nodejs-org May 12, 2023 19:17 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org-stories May 12, 2023 19:18 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org-stories May 12, 2023 19:21 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org May 12, 2023 19:22 Inactive
@Harkunwar Harkunwar marked this pull request as ready for review May 13, 2023 02:06
@Harkunwar Harkunwar requested a review from ovflowd May 13, 2023 02:06
@Harkunwar Harkunwar requested a review from shanpriyan May 13, 2023 02:10
@Harkunwar Harkunwar changed the title reafactor(useDownloadLink): Move useDetectOs to useDownloadLink refactor(useDownloadLink): Move useDetectOs to useDownloadLink May 13, 2023
@shanpriyan
Copy link
Contributor

I think we can remove the hooks/__test__/useCopyToClipboard.test.tsx file in a separate PR 🤔

Copy link
Contributor

@shanpriyan shanpriyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit:

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vercel vercel bot temporarily deployed to Preview – nodejs-org-stories May 14, 2023 16:20 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org May 14, 2023 16:21 Inactive
@Harkunwar Harkunwar force-pushed the refactor/use-download-link branch from 1b05b01 to 7dc5791 Compare May 15, 2023 00:54
@vercel vercel bot temporarily deployed to Preview – nodejs-org-stories May 15, 2023 00:55 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org May 15, 2023 00:57 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org May 15, 2023 00:59 Inactive
@vercel vercel bot temporarily deployed to Preview – nodejs-org-stories May 15, 2023 01:00 Inactive
@Harkunwar Harkunwar enabled auto-merge (squash) May 15, 2023 01:03
@Harkunwar Harkunwar merged commit 4444889 into nodejs:major/website-redesign May 15, 2023
ovflowd added a commit that referenced this pull request May 17, 2023
* test(snapshot): Migrate snapshot tests to storybook (#5340)

Co-authored-by: Manish Kumar ⛄ <[email protected]>
Co-authored-by: Wai.Tung <[email protected]>
Co-authored-by: Shanmughapriyan S <[email protected]>
Co-authored-by: Michael Esteban <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>
Co-authored-by: Teja Sai Sandeep Reddy Konala <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>
Co-authored-by: vasanth9 <cheepurupalli.vasanthkumar.com>
Co-authored-by: Aymen Naghmouchi <[email protected]>
Co-authored-by: Teja Sai Sandeep Reddy Konala <[email protected]>
Co-authored-by: Augustin Mauroy <[email protected]>
Co-authored-by: Guilherme Araújo <[email protected]>
Co-authored-by: Augustin Mauroy <[email protected]>
Co-authored-by: HinataKah0 <[email protected]>
Co-authored-by: Olaleye Blessing <[email protected]>
Co-authored-by: ktssr <[email protected]>
Co-authored-by: vasanthkumar <[email protected]>
Co-authored-by: Floran Hachez <[email protected]>
Co-authored-by: Jatin <[email protected]>
fixed styleling misconfig and fixed storybooks (#5281)
fix storybook styles, imports, typescript config and dependencies (#5319
fix(package.json) Lint command is missing slashes (#5321
fix storybook local development mode (#5335)
fix(i18n): translation key (#5347)

* chore: no-unused-vars ignores pattern starting with _ (#5363)

* Contributing Guidelines Update - Add clarity to step 4 based on clone method (#5369)

Add clarity to step 4 based on clone method

Signed-off-by: Vessy Shestorkina <[email protected]>

* fix(test): dir name (#5354)

* feat(stability): migrate component (#5339)

* Migrate JsonLink component (#5370)

* Migrate JsonLink component

Signed-off-by: Vessy Shestorkina <[email protected]>

* Add storybook snap and robot icon

Signed-off-by: Vessy Shestorkina <[email protected]>

* Remove IconContext provider

Signed-off-by: Vessy Shestorkina <[email protected]>

---------

Signed-off-by: Vessy Shestorkina <[email protected]>
Signed-off-by: Claudio Wunder <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>

* refactor(useDownloadLink): Move useDetectOs to useDownloadLink (#5376)

* refactor(useDownloadLink): Move useDetectOs to useDownloadLink

* refactor(useDownloadLink): rename file

* refactor(useDownloadLink): rename file

* Apply suggestions from code review

Signed-off-by: Claudio Wunder <[email protected]>

* refactor(useDownloadLink): undo deleted file

---------

Signed-off-by: Claudio Wunder <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>

* feat: Add MUI Config and Theme Provider (#5368)

* feat: Add MUI Config and Theme Provider

* added createTheme

* refactor themeConfig

* feat(theme): Fix linting and package-lock

* feat(theme): Add emotion styled and emtion react

---------

Co-authored-by: Harkunwar Kochar <[email protected]>

* refactor(delete): duplicate test file (#5377)

refactor(test): Delete duplicate test file

Co-authored-by: Claudio Wunder <[email protected]>

* feat(useClickOutside): introduce (#5359)

* feat(useClickOutside): introduce

* Update hooks/useClickOutside.ts

Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* feat(useClickOutside): fix and twix

* feat(dropdown): remove useless ref

* feat(useClickOutside): update unit test

* feat(UseClickOutside): update type

* fix: usage of type

* Update hooks/useClickOutside.ts

Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* update listener

* Update components/Common/LanguageSelector/index.tsx

Co-authored-by: Shanmughapriyan S <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* fix: languageSelector

* update with feedback

* better unit test

* Update hooks/useClickOutside.ts

Co-authored-by: Harkunwar Kochar <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* feat(useClickOutside): update with feedback

* Update hooks/useClickOutside.ts

Co-authored-by: Shanmughapriyan S <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* Update hooks/useClickOutside.ts

Co-authored-by: Shanmughapriyan S <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* fix: if click on modal

* Update hooks/useClickOutside.ts

Co-authored-by: Harkunwar Kochar <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* Update hooks/useClickOutside.ts

Signed-off-by: Harkunwar Kochar <[email protected]>

* Update hooks/useClickOutside.ts

Co-authored-by: Harkunwar Kochar <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* Update useClickOutside.ts

* Update hooks/useClickOutside.ts

Co-authored-by: Shanmughapriyan S <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* Update useClickOutside.ts

* Apply suggestions from code review

Signed-off-by: Claudio Wunder <[email protected]>

* Update hooks/useClickOutside.ts

Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* Update hooks/useClickOutside.ts

Co-authored-by: Claudio Wunder <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

* fix: build

---------

Signed-off-by: Augustin Mauroy <[email protected]>
Signed-off-by: Harkunwar Kochar <[email protected]>
Signed-off-by: Claudio Wunder <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>
Co-authored-by: Shanmughapriyan S <[email protected]>
Co-authored-by: Harkunwar Kochar <[email protected]>

---------

Signed-off-by: Vessy Shestorkina <[email protected]>
Signed-off-by: Claudio Wunder <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>
Signed-off-by: Harkunwar Kochar <[email protected]>
Co-authored-by: Harkunwar Kochar <[email protected]>
Co-authored-by: Manish Kumar ⛄ <[email protected]>
Co-authored-by: Wai.Tung <[email protected]>
Co-authored-by: Shanmughapriyan S <[email protected]>
Co-authored-by: Michael Esteban <[email protected]>
Co-authored-by: Teja Sai Sandeep Reddy Konala <[email protected]>
Co-authored-by: Aymen Naghmouchi <[email protected]>
Co-authored-by: Teja Sai Sandeep Reddy Konala <[email protected]>
Co-authored-by: Augustin Mauroy <[email protected]>
Co-authored-by: Guilherme Araújo <[email protected]>
Co-authored-by: Augustin Mauroy <[email protected]>
Co-authored-by: HinataKah0 <[email protected]>
Co-authored-by: Olaleye Blessing <[email protected]>
Co-authored-by: ktssr <[email protected]>
Co-authored-by: vasanthkumar <[email protected]>
Co-authored-by: Floran Hachez <[email protected]>
Co-authored-by: Jatin <[email protected]>
Co-authored-by: Vessy <[email protected]>
Co-authored-by: Mert Can Altın <[email protected]>
ovflowd added a commit that referenced this pull request May 24, 2023
* refactor(useDownloadLink): Move useDetectOs to useDownloadLink

* refactor(useDownloadLink): rename file

* refactor(useDownloadLink): rename file

* Apply suggestions from code review

Signed-off-by: Claudio Wunder <[email protected]>

* refactor(useDownloadLink): undo deleted file

---------

Signed-off-by: Claudio Wunder <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>
ovflowd added a commit that referenced this pull request May 24, 2023
* refactor(useDownloadLink): Move useDetectOs to useDownloadLink

* refactor(useDownloadLink): rename file

* refactor(useDownloadLink): rename file

* Apply suggestions from code review

Signed-off-by: Claudio Wunder <[email protected]>

* refactor(useDownloadLink): undo deleted file

---------

Signed-off-by: Claudio Wunder <[email protected]>
Co-authored-by: Claudio Wunder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants